package wsepForum.network.server.gate;

import wsepForum.domain.Session;
import wsepForum.network.common.GUIAnswer;
import wsepForum.network.common.GUIRequest;
import wsepForum.network.common.RequestSerializer;
import wsepForum.network.server.GUIToken;

/**
 * Server's GUI interface towards the client
 * @author Oren Ben-Haim
 *
 */
public class ServerGUIController implements IUIController<GUIToken<GUIRequest>> {
	
	/*****************************
	 * MEMBERS                   *
	 *****************************/
	/* (non-Javadoc)
	 * @see wsepForum.ui.IUIController#getRequest(java.lang.Object, wsepForum.domain.Session)
	 */
	@Override
	public String getRequest(GUIToken<GUIRequest> token, Session session) {
		// handle request
		GUIAnswer answer = GUIRequestHandler.handleRequest(token.getData(), session);
		// serialize and send
		return RequestSerializer.serialize(answer);
	}

	/* (non-Javadoc)
	 * @see wsepForum.ui.IUIController#getWelcome()
	 */
	@Override
	public String getWelcome() {
		// no welcome message
		return null;
	}




}
